const Classify_type = (type, time, language, region, page) => {
    const formdata = new FormData();
    formdata.append('type', type);
    formdata.append('time', time);
    formdata.append('language', language);
    formdata.append('region', region);
    formdata.append('page', page);

    return (dispatch) => {
        let url = 'http://www.h5weixin.club:8000/type'
        fetch(url, {
            method: 'POST',
            mode: 'cors',
            body: formdata
        }).then((res) => {
            return res.json()
        }).then((res) => {
            // console.log(res.data)
            if (res.code == 200) {
                dispatch({
                    type: 'Classify_success',
                    data: res
                })
            }
        }).catch((err) => {
            console.log(err);
        })
        return Promise.resolve();//通过返回promise解决状态异步更新的问题
    }
}
export default Classify_type;
